#ifndef AER_FRAMEBUFFER_HPP_
#define AER_FRAMEBUFFER_HPP_

#include "aerRenderTarget.hpp"
#include "aerRenderbuffer.hpp"


namespace aer {


class FrameBuffer : public RenderTarget
{
  private:
      static const unsigned int kAttachmentMax = 8u;

  
  private:
    GLenum m_attachments[kAttachmentMax];
    
    const Texture* m_pTextures[kAttachmentMax];
    unsigned int m_numTextures;
    
    const Texture* m_pSpecialBuffer;
    Renderbuffer m_renderbuffer;

  
  public:    
    FrameBuffer();
    ~FrameBuffer();


    void begin();
    void end();
    
    void resize(const U32 width, const U32 height);//
    
    void attachColorBuffer(const Texture *pTexture, GLenum attachment);
    void attachSpecialBuffer(const Texture *pTexture, GLenum attachment);
    
    
    //void createRenderBuffer(GLenum attachment);    
    //Texture* getTexture(GLenum attachment) const;
    
    
  private:
    bool checkSpecialFormat(int internalFormat, GLenum attachment);
};
  
} // aer

#endif //AER_FRAMEBUFFER_HPP_
